
/**
 * Responsible for storing data pertaining to a two player word game. 
 * 
 * @author Sam Snyder
 *
 */
public interface GameModel {

	/**
	 * Checks that a String conforms to certain guidelines.
	 * 
	 * @param word the word to be checked for validity
	 * @return true if the word is valid, false otherwise.
	 */
	boolean wordValid(String word);
	
	/**
	 * Sets a given player's secret word to the specifed string.
	 * 
	 * @param p the player in question.
	 * @param secret the secret word being assigned to them.
	 * @throws WordException If there is a problem with the word
	 */
	void setSecretWord(PlayerSelect p, String secret) throws WordException;
	
	/**
	 * Attempt to guess the given player's secret word.
	 * 
	 * @param p the player whose secret word is being attempted
	 * @param word the word being guessed
	 * @return number of letters shared
	 * @throws WordException If there is a problem with the word
	 */
	int guess(PlayerSelect p, String word) throws WordException;
	
	/**
	 * 
	 * @return true if the last guess perfectly matched the secret word
	 */
	boolean lastPerfectlyMatched();
	
	/**
	 * Awards players points and/or wins based upon the number of guesses taken to 
	 * complete the game.
	 * 
	 * @return the player who won this game. null if implementer allows a tie.
	 */
	PlayerSelect concludeGame();
	
	/**
	 * @param p the player in question
	 * @return the player's score
	 */
	int getScore(PlayerSelect p);
	
	/**
	 * @param p the player in question
	 * @return the player's score
	 */
	int getWins(PlayerSelect p);
	
	/**
	 * @param p the player in question
	 * @return true if the player has reached its guess limit, false otherwise.
	 */
	boolean guessLimitReached(PlayerSelect p);
	
	/**
	 * Sets model back to the state it had immediately after construction, but leaves
	 * scores and wins intact.
	 */
	void newGame();
}
